package net.jiastudy.biz.enums;

import java.io.Serializable;

import com.baomidou.mybatisplus.enums.IEnum;

public enum Gender implements IEnum {
	male(1, "男"), female(2, "女");

	private int value;
	private String desc;

	Gender(final int value, final String desc) {
		this.value = value;
		this.desc = desc;
	}

	@Override
	public Serializable getValue() {
		return this.value;
	}

	public String getDesc() {
		return this.desc;
	}

	@Override
	public String toString() {
		return this.name();
	}

	public static Gender descOf(String desc) {
		for (Gender type : values()) {
			if (type.desc.equals(desc)) {
				return type;
			}
		}
		throw new IllegalArgumentException("Invalid Gender name: " + desc);
	}
}
